package com.qqbot.service.group;

import com.qqbot.exception.BusinessException;
import com.qqbot.model.group.UserGroupRelation;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author fyq
 * @since 2023-03-02
 */
public interface UserGroupRelationService extends IService<UserGroupRelation> {

    /**
     * 是否是黑名单
     *
     * @param bot
     * @param qq
     * @param groupNo
     * @return
     * @throws BusinessException
     */
    boolean isItBlacklist(String bot, String qq, String groupNo) throws BusinessException;

    /**
     * 添加群组用户
     *
     * @param bot
     * @param qq
     * @param groupNo
     * @param status
     * @param integral
     * @return
     * @throws BusinessException
     */
    boolean saveOrUpdateGroupUser(String bot, String qq, String groupNo, Integer status, Integer integral) throws BusinessException;

    /**
     * 根据群和QQ集合获得群成员列表
     *
     * @param bot
     * @param groupNo
     * @param qqList
     * @return
     * @throws BusinessException
     */
    List<UserGroupRelation> listByGroupAndQqList(String bot, String groupNo, List<String> qqList) throws BusinessException;

    /**
     * 根据群号和QQ集合批量更改状态
     *
     * @param groupNo
     * @param qqList
     * @return
     * @throws BusinessException
     */
    boolean updateStatusByGroupAndQqList(String groupNo, List<String> qqList) throws BusinessException;

    /**
     * 根据QQ和群号获取群成员信息
     *
     * @param bot
     * @param qq
     * @param groupNo
     * @return
     * @throws BusinessException
     */
    UserGroupRelation getByQqAndGroupNo(String bot, String qq, String groupNo) throws BusinessException;

    /**
     * 增加群成员积分
     *
     * @param bot
     * @param qq
     * @param groupNo
     * @param integral
     * @return
     * @throws BusinessException
     */
    boolean addIntegral(String bot, String qq, String groupNo, Integer integral) throws BusinessException;

    /**
     * 积分排行(只取前十条)
     *
     * @param bot
     * @param groupNo
     * @return
     * @throws BusinessException
     */
    List<UserGroupRelation> integralRanking(String bot, String groupNo) throws BusinessException;
}
